<template>
	<view class="">
		<view style="display: flex; justify-content: center; padding: 20px;">
			<input type="text" class="text" placeholder="请输入..." v-model="button" />
			<view class=""><button type="button" @click="sousuo()">搜索</button></view>
		</view>
		<view class="box" v-for="(item,index) in datas" style="display: flex;">
			<image :src="'http://124.93.196.45:10001/dev-api'+item.logoPic" mode="aspectFit"></image>
			<view class="" style="display: flex;flex-direction: column; justify-content:space-evenly;">
				<text style="font-size: 50px;">{{item.apkName}}</text>
				<view class="" style="display: flex; justify-content:space-between;">
					<view class=""><text>{{item.introduce}}</text></view>
					
				</view>
				<view @click="xiazai(item.apkName)" style="padding:10px 5px; background-color: blue;
				border-radius: 10px; color: #fff; width: 60px; text-align: center;">下载</view>
			</view>
			
		</view>
	</view>
</template>

<script setup>
	export default {
		data() {
			return {
				button: "",
				token: "",
				data: null,
				datas: []
			}
		},
		methods: {
			
			sousuo() {
				this.datas=[]
				this.data=uni.getStorageSync("data")
				if (this.button=="") {
					return
				}
				for (var i = 0; i < this.data.length; i++) {
					if (this.data[i].apkName!=null) {
						if (this.data[i].apkName.includes(this.button.trim()) ){
							this.datas.push(this.data[i])
						}
					}
				}
			},
			xiazai(a){
				uni.showToast({
					title: a + "正在下载...",
					icon: "none",
					duration: 2000
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.fanhui {
		font-size: 30px;
		margin-left: 10px;
	}

	.text {
		width: 400px;
		padding: 5px;
		text-align: center;
		border-radius: 20px 0 0 20px;
		border: 1px solid #000;
	}

	button {
		width: 100px;
		height: 34px;
		line-height: 38px;
		border-radius: 0 20px 20px 0;
		background-color: blue;
		color: #fff;
	}
	.box{
		padding: 0px 20px;
		border: 1px solid #000;
		border-radius: 50px;
		margin: 50px;
	}
	.box image{
		width: 250px;
		margin: 0px 20px;
	}
</style>